package cn.ifavor.appframework;

import android.app.Activity;
import android.support.v7.widget.Toolbar;

/**
 * BaseActivity 主要是对 Toolbar 的封装
 */
public abstract class BaseActivity extends Activity {

    private Toolbar mToolbar;

    public void setContentView(int layoutResID, int titleRes, int logoRes) {
        super.setContentView(layoutResID);

        mToolbar = (Toolbar) findViewById(R.id.toolbar_top);

        if (mToolbar == null){
            return;
        }

        mToolbar.setTitle(titleRes);

        if (logoRes > 0){
            mToolbar.setLogo(logoRes);
        }
    }

    public void setContentView(int layoutResID, int titleRes) {
        setContentView(layoutResID, titleRes, -1);
    }

}
